package ru.ncedu.java.vlku.hrs.uil.cmd;

import ru.ncedu.java.vlku.hrs.bll.HRSManager;
import ru.ncedu.java.vlku.hrs.bll.HRSManagerFactory;
import ru.ncedu.java.vlku.hrs.model.Storage;

import java.util.List;

public class GetAllStorages implements Command {
    @Override
    public void execute(String[] args) {
        if (args.length != 2)
            throw new IllegalArgumentException();
        HRSManager manager = HRSManagerFactory.getInstance().getHRSManager();
        List<Storage> storages = manager.getAllStorages();
        System.out.println("Id\tName\tAddress");
        for (int i = 0; i < storages.size(); i++)
            System.out.println(storages.get(i).getId() + "\t" + storages.get(i).getName() + "\t" + storages.get(i).getAddress());
    }
}
